package com.wxh.lock;

import java.util.concurrent.locks.StampedLock;

/**
 * @ClassName: StampedSample
 * @Description: 压印样例：基于读写锁实现数据结构，还优化读模式
 * @Author wxh
 * @Date: 2022/2/9 16:03
 * @Version V1.0.0
 * @Since 1.8
 */
public class StampedSample {

    private final StampedLock sl = new StampedLock();

    public void mutate(){
        long stamp = sl.writeLock();
        try {
            System.out.println(" 写操作 ");
        }finally {
            sl.unlockWrite(stamp);
        }
    }


}
